package io.github.lee.app.unsplash.ui.detail.photo

import android.content.Context
import android.view.ViewGroup
import android.widget.TextView
import androidx.core.view.setPadding
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import com.chad.library.adapter.base.BaseSingleItemAdapter
import com.chad.library.adapter.base.viewholder.QuickViewHolder
import io.github.lee.app.unsplash.R
import io.github.lee.core.util.toPx

class RelatedHeaderAdapter : BaseSingleItemAdapter<String, QuickViewHolder>("") {

    override fun onBindViewHolder(holder: QuickViewHolder, item: String?) {

    }

    override fun onCreateViewHolder(
        context: Context,
        parent: ViewGroup,
        viewType: Int
    ): QuickViewHolder {
        val text = TextView(context)
        text.setTextColor(context.getColor(R.color.white))
        text.textSize = 16F
        text.setText(R.string.txt_related_photo)
        text.setPadding(8.toPx(context))
        val p = StaggeredGridLayoutManager.LayoutParams(
            StaggeredGridLayoutManager.LayoutParams.WRAP_CONTENT,
            StaggeredGridLayoutManager.LayoutParams.WRAP_CONTENT
        )
        p.isFullSpan = true
        text.layoutParams = p
        return QuickViewHolder(text)
    }
}